package ua.nure.nguyen.blinove.chapter6.annotation.examples;

import java.lang.reflect.Method;

public class SecurityLogic {
	public void onInvoke(SecurityLevel securityLevel, Method method,
			Object[] args) {
		StringBuilder argsString = new StringBuilder();
		for (Object arg : args) {
			argsString.append(args.toString() + " :");
		}
		argsString.setLength(argsString.length() - 1);
		System.out.println(String.format(
				"Method %s was invoked with parameters : %s", method.getName(),
				argsString.toString()));
		switch (securityLevel) {
		case LOW:
			System.out.println("Low level security");
			break;
		case NORMAL:
			System.out.println("Normal level security");
			break;
		case HIGH:
			System.out.println("High level security");
			break;
		}
	}
}
